<!doctype html>
<!--[if IE 7 ]>    <html lang="en" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]>    <html lang="en" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]>    <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->
<html lang="en" class="no-js"> <!--<![endif]-->
<head>
    <?php use_helper('I18N') ?>
    <?php include('scripts.php'); ?>

    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- CSS Styles -->
    <!-- <link rel="stylesheet" href="/css/style.css">-->
    <!-- <link rel="stylesheet" href="/css/colors.css">-->

    <!-- Google WebFonts -->
    <link href='http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic' rel='stylesheet'
          type='text/css'>
    <style type="text/css">
        .redbutton {
            background: #ae432e url('/images/btns/btn_red.png') repeat-x left top;
        }

        html, body {
            margin: 0;
            overflow: hidden;
        }

        body {
            background: #000 url(/images/login/background.jpg) repeat;
            font-family: Arial, Helvetica, sans-serif;
        }

        #errMsg {
            background: #ae2a2a;
            color: #fff;
            font-size: 12px;
            padding: 5px 3px;
        }

        #loginContainer {
            width: 300px;
            margin: 8% auto;
        }

        #loginContainer .outline {
            background: url(/images/login/outline.png) repeat;
            padding: 10px;
            width: 280px;
        }

        #loginContainer .register, #loginContainer .register a {
            color: #939598;
            text-decoration: none;
            font-size: 11px;
            text-align: right;
            padding: 5px 0;
        }

        #loginContainer .register a:hover {
            color: #fff;
            text-decoration: underline
        }

        #login {
            background: #fff;
        }

        #login td {
            padding: 10px 0 0 0;
            font-size: 12px;
            color: #6D6E71
        }

        #login .logo, #login .screen {
            padding: 0
        }

        #login input[type=text], #login input[type=password] {
            width: 140px;
            border: 1px solid #ccc;
            padding: 3px;
        }

        #login .text {
            font-weight: bold;
            padding-left: 20px;
            width: 95px;
        }
    </style>
    <script>
        $(function() {
            $("#lang").change(function() {
                $("#doAction").val("lang");
                $("#loginForm").submit();
            });

            $("#btnLogin").click(function() {

            });

            $("#captchaimage").bind('click', function() {
                $.post('/captcha/newSession');
                $("#captchaimage").load('/captcha/imageRequest');
                return false;
            });

            $("#loginForm").validate({
                        rules: {
                        <?php if (sfConfig::get('sf_environment') == Globals::SF_ENVIRONMENT_PROD) { ?>
                            captcha: {
                                required: true,
                                remote: "/captcha/process"
                            }
                            <?php } ?>
                        },
                        messages: {
                            captcha: "Correct captcha is required."
                        },
                        submitHandler: function(form) {
                            if ("" == $("#doAction").val()) {
                            <?php if (sfConfig::get('sf_environment') == Globals::SF_ENVIRONMENT_PROD) { ?>
                                if ($.trim($("#username").val()) == "") {
                                    alert("Shareholder ID cannot be blank.");
                                    $("#username").focus();
                                    return false;
                                }
                                if ($.trim($("#userpassword").val()) == "") {
                                    alert("Password cannot be blank.");
                                    $("#userpassword").focus();
                                    return false;
                                }
                                <?php } ?>
                            }

                            form.submit();
                        }
                    });
            /*alert("<p>致广大的股东们，</p>"
               + "<p>本公司为了解决少许的技术问题，将会在十二点正关闭股东登陆服务达三小时。请任何要报单的股东们稍后再报单或登陆。谢谢。 </p>"
               + "<p>Tune Ventures电脑管理部</p>"
                   + "<br>"
                   + "<p>Dear All Valued Shareholders, </p>"
                   + "<p>In order to solve a little technical issue, our company decided to shut down the shareholder login system for 3 HOURS time start from 12am. If there is any new registration, kindly do it after this down time. Thank you.</p>"
                   + "<p>Tune Ventures IT Department</p>"
           + "</dl>");*/
        });
        function alert(data) {
            var msgs = "";
            if ($.isArray(data)) {
                jQuery.each(data, function(key, value) {
                    msgs = value + "<br>";
                });
            } else {
                msgs = data + "<br>";
            }

            var alertPanel = "<div style='margin-bottom: 20px; padding: 0 .7em;' class='ui-state-highlight ui-corner-all'><p><span style='float: left; margin-right: .3em;' class='ui-icon ui-icon-info'></span>";
            alertPanel += msgs + "</p></div>";
            $("#waitingLB h3").html(alertPanel);
            $.blockUI({
                        message: $("#waitingLB")
                        , css: {
                            border: 'none',
                            padding: '5px',
                            '-webkit-border-radius': '10px',
                            '-moz-border-radius': '10px',
                            'border-radius': '10px',
                            opacity: .9
                        }});
            $(".blockOverlay").css("z-index", 1010);
            $(".blockPage").css("z-index", 1011);
            $('.blockOverlay').attr('title', 'Click to unblock').click($.unblockUI);
        }
    </script>
</head>
<div id="waitingLB" style="display:none; cursor: default">
    <h3>We are processing your request. Please be patient.</h3>
</div>
<body class="login">
<form action="/home/doLogin" id="loginForm" method="post">
<input type="hidden" name="doAction" id="doAction" value="">
<div id="loginContainer">
    <div class="outline">
        <table width="280" border="0" cellspacing="0" cellpadding="0" id="login">
          <tr>
            <td colspan="2" class="logo"><img src="/images/login/logo.jpg" alt="logo" /></td>
          </tr>
          <tr>
            <td colspan="2" class="screen"><img src="/images/login/login_img.jpg" alt=""/></td>
          </tr>
          <tr>
            <td class="text"><?php echo __('Shareholder ID') ?></td>
            <td>
                <input type="text" name="username" id="username" class="large"
                                   value="<?php echo $username; ?>">
            </td>
          </tr>
          <tr>
            <td class="text"><?php echo __('Password') ?></td>
            <td>
                <input type="password" name="userpassword" id="userpassword" class="large"
                                   value="<?php echo $userpassword; ?>">
            </td>
          </tr>
          <tr>
            <td class="text"><?php echo __('Language') ?></td>
            <td>
                <select name="lang" id="lang">
                    <option value="en"
                            <?php
                                if ($sf_user->getCulture() == "en")
                                    echo 'selected'
                            ?>
                            >English
                    </option>
                    <option value="cn"
                            <?php
                                if ($sf_user->getCulture() == "cn")
                                    echo 'selected'
                            ?>
                            >中文
                    </option>
                </select>
            </td>
          </tr>
          <tr>
            <td colspan="2" align="right" style="padding-right:20px;padding-bottom:15px;">
                <?php if ($sf_flash->has('errorMsg')) { ?>
                <div class="notification error">
                    <p style="color: red"><strong><?php echo $sf_flash->get('errorMsg') ?></strong></p>
                </div>
                <?php
            }
                if ($appSetting->getSettingValue() == '0') {
                    ?>
                    <!-- <button type="submit" class="right redbutton">--><?php //echo __('Login') ?><!--</button>-->

                    <input type="image" src="/images/login/btn_login.png"
                        onmouseover="this.src='/images/login/btn_login_hover.png'"
                        onmousedown="this.src='/images/login/btn_login_click.png'"
                        onmouseout="this.src='/images/login/btn_login.png'" name="submit" id="button" value="Submit" />
                    <?php } ?>
            </td>
          </tr>
        </table>
	</div>
    <div class="register">
    	<a href="/member/register"><?php echo __('Register') ?></a> | <a href="/member/forgetPassword"><?php echo __('Forget Password?') ?></a>
    </div>
</div>

</form>
</body>
</html>